package com.luyun.frogpay.base.dialog;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.luyun.frogpay.R;


/**
 * Created by admin on 2018/5/8.
 */

public class RxDialogProgress extends RxDialog {
    private ProgressBar progressBar;
    private int progress;
    private TextView progressTv;
    private TextView mTvSure;

    public RxDialogProgress(Context context, int themeResId) {
        super(context, themeResId);
        initView();
    }

    public RxDialogProgress(Context context, boolean cancelable, OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
        initView();
    }

    public RxDialogProgress(Context context) {
        super(context);
        initView();
    }

    public RxDialogProgress(Context context, float alpha, int gravity) {
        super(context, alpha, gravity);
        initView();
    }

    public TextView getProgressTv() {
        return progressTv;
    }

    public void setProgressTv(int progress) {
        this.progressTv.setText(this.progress + "%");
    }

    public ProgressBar getProgressBar() {
        return progressBar;
    }

    public void setProgressBar(ProgressBar progressBar) {
        this.progressBar = progressBar;
    }

    public int getProgress() {
        return progressBar.getProgress();
    }

    public void setProgress(int progress) {
        progressBar.setProgress(progress);
    }

    public TextView getmTvSure() {
        return mTvSure;
    }

    public void setmTvSure(TextView mTvSure) {
        this.mTvSure = mTvSure;
    }

    public TextView getSureView() {
        return mTvSure;
    }

    public void setSureListener(View.OnClickListener listener) {
        mTvSure.setOnClickListener(listener);
    }

    public void setSure(String content) {
        mTvSure.setText(content);
    }


    private void initView() {
        View dialogView = LayoutInflater.from(getContext()).inflate(R.layout.__dialog_progress, null);
        progressBar = dialogView.findViewById(R.id.dialog_progressbar);
        mTvSure = (TextView) dialogView.findViewById(R.id.tv_sure);
        progressTv = (TextView) dialogView.findViewById(R.id.dialog_progress_tv);
        setContentView(dialogView);
    }
}
